Title: CustomValveIsolation
Version: 1.6
Revisions:
1.6 1/03/08 – fixed issue when tracing
near water source; also fixed issue finding some SDE layers
1.5 9/7/05 – adjusted 9.x
code to match 8.x in how it finds network
1.4 11/09/04 – includes code for 9.x and
8.x
1.3
1.2
User received message “No valves can be
reached from the specified flag." in error.
Provided by:
ESRI-TeamWater as an un
Purpose: A single key press performs a valve isolation
trace and displays results.
Files:
ReadMe_CustomValveIsolation.htm
CustomValveIsolation.bas
NetworkElement.cls
Data requirements:
Overview of setup (detailed instructions follow this overview):
1) use VBA (provided with ArcMap) two import the two code files
provided with this sample.
2) alter the user configuration at the top of the code to match
your data
3) assign
the CustomValveIsolation procedure to a keyboard
click such as F12 or Ctrl+I
4) save
your mxd (if you did not elect to save these changes
to normal)
Setup:
In ArcMap
Tools>Macros>VB
Editor
In VB
Editor
In the Project Window…
Click
Project to store changes for this map document only or
Click
File>Import
File...
Navigate
to NetworkElement.cls and click Open
File>Import
File...
Navigate
to CustomValveIsloation.bas and click Open
Expand
the Modules folder
Double-click
the CustomValveIsolation module to view the code
Change
the user configuration as desired (see user configuration below)
Close VB
Window
In
ArcMap, Tools> Customize...
Click
Keyboard...
Under
Categories, highlight Macros
Under
Commands, highlight CustomValveIsolation
Place
your cursor the the input box labelled
“Press new shortcut key:”
Now press
desired shortcut key combination such as Ctrl+I
Read
whether this key is already currently assign to another function
If not,
click Assign
Otherwise,
pick another keyboard combination and if unused Click Assign
Close
Customize dialogs
If you chose to save your changes with this Project, save
your map document now.
User configuration:
You may
need to change the constants at the top of the code to match your data. Here’s a list of the constants and their
default values and descriptions.
Changes can be made to the top of the module called CustomValveIsolation.
|
Constants |
Default Value (user may change) |
Description |
Special Notes |
|
c_sNetworkName |
"Potable_Water_Network" |
Name of water geometric network |
|
|
c_ sStationFCName |
"wNetworkStructure" |
Name of feature class containing treatment
plants, tanks, or other source points |
|
|
c_ sValveFCName |
"wSystemValve" |
Name of feature class containing
system valves |
|
|
c_sOperableFieldName |
"Operable" |
Name of field in valve feature
class indicating whether a valve can be used |
If the specified field is not
found, trace will presume all valves are operational. |
|
c_sInoperableValue |
"N" |
Indicates the value for valves to
skip |
|
|
c_iSearchTolerance |
20 |
Search tolerance in map units |
|
To use:
In ArcMap, be sure you have the necessary layers in your map.
Set the selectable layers as desired.
Using any tool such as identify, select, or
whatever...
Hover over the location along the pipe and use your assigned keyboard
shortcut.
Here's what happens...
Any existing network trace flags and feature selections are cleared.
A network trace edge flag is automatically placed at the specified
location.
The symbology of the flag is based on your
current default point symbol (Drawing Toolbar).
The isloation trace will be performed.
An identify window will open showing the valves to close.
It will also show any selectable point features along the isloated pipe.
Close the identify window before attempting another trace.
Edge flags and trace results are automatically cleared when a new trace
is performed.
Tips for nicer results...
Set your valve layer selection symbol so that
when selected it still shows your valve symbol.
To do this, right-click your system valve
layer in the TOC. Go to properties.
Click the selection tab. Click the "Use this color" option
and choose a color.
You can also do this with other selectable
layers such as hydrants and meters.
If you’ve
set the use this color option, but don’t see that color when features are
selected, be sure that your symbol has at least one unlocked pattern.
Edge flags and trace results can be manually cleared using
the Utility Network analyst commands “Clear Flags” and “Clear Results”. Go to Tools> Customize, click the Commands
tab and drag each of these commands on to any toolbar. Or from the Customize dialog, click keyboard
and assign these commands to a keyboard shortcut.
Credits:
This code is based on a developer sample called Isolation
Trace Task. It has been modified by
ESRI-Charlotte technical staff. Special
acknowledgement goes to
Your Input:
Please send any comments via email to